package com.example.demo.serviceImpl;

import com.example.demo.mapper.InfoMapper;
import com.example.demo.service.InfoService;
import com.example.demo.utils.Result;
import com.example.demo.vo.InfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class InfoServiceImpl implements InfoService {
    @Autowired
    InfoMapper infoMapper;
    @Autowired
    private RedisTemplate redisTemplate;

    @Override
    public List<InfoVo> getInfo(){
        return infoMapper.getInfo();
    }
    @Override
    public Integer setInfo(InfoVo infoVo){
        System.err.println(infoVo.getName());
        System.err.println(redisTemplate.opsForValue().get("name"));
        redisTemplate.opsForValue().set("name",infoVo.getName());
        return infoMapper.setInfo(infoVo.getName(),infoVo.getSex(),infoVo.getAge());
    }

    @Override
    public List<InfoVo> getUserName(){
        return infoMapper.getUserName();
    }

    @Override
    public InfoVo findUserById(int id){
        return infoMapper.findUserById(id);
    }


}
